package server;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import server.dao.UserInfoMapper;
import server.model.UserInfo;

import java.io.IOException;
import java.io.Reader;

public class fsgsdfg {

    private static SqlSessionFactory sqlSessionFactory;

    public static void main(String[] args) throws IOException {
        Reader reader = Resources.getResourceAsReader("mybatis-config.xml");
        sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);


        SqlSession sqlSession = sqlSessionFactory.openSession();
        UserInfoMapper mapper = sqlSession.getMapper(UserInfoMapper.class);
        UserInfo hahaha = mapper.selectByPrimaryKey("hahaha");
        System.out.println(hahaha.getNickname());


    }

}
